package fnord.jovian;

import java.awt.*;
import javax.swing.*;

public class TheGUI extends JFrame {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -66128916356399833L;
	
	private TheGUICommunicator _com;
	private TheBoard _board;

	public TheGUI() {
		super("FNORD");
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		_com = new TheGUICommunicator(this);
	}
	
	public TheGUICommunicator getCommunicator() {
		return _com;
	}
	
	public void newBoard(TheBoard board) {
		_board = board;
		this.add(board, BorderLayout.CENTER);
	}
	
	public void resetBoard() {
		_board.reset();
	}
	
	public TheBoard getBoard() {
		return _board;
	}
	
	public static void main(String [] argv) {
		TheGUI gui = new TheGUI();
		gui.setLayout(new BorderLayout());
		TheBoard board = new TheBoard(gui.getCommunicator());
		gui.newBoard(board);
		//gui.setUndecorated(true);
		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
		@SuppressWarnings("unused")
        GraphicsDevice dev = ge.getDefaultScreenDevice();
		//dev.setFullScreenWindow(gui);
		gui.setSize(new Dimension(800, 600));
		gui.setVisible(true);
		board.resize();
	}
	
}
